package com.service.auth.impl;

import java.util.List;

import javax.annotation.Resource;

import com.dao.auth.RoleDao;
import com.dao.auth.RoleResDao;
import com.dao.auth.UserRoleDao;
import com.model.auth.Role;
import com.service.auth.IRoleService;

public class RoleServiceImpl implements IRoleService {
	
	@Resource
	private RoleDao  roleDao;
	@Resource
	private UserRoleDao userRoleDao;
	@Resource
	private RoleResDao roleResDao;
	
	public boolean delRoleById(int id) throws Exception {
		// TODO Auto-generated method stub
		return roleDao.delRoleById(id) && userRoleDao.delUserRolesByRoleId(id) && roleResDao.delAllResByRoleId(id);
	}

	public Role getRoleById(int id) throws Exception {
		// TODO Auto-generated method stub
		return roleDao.getRoleById(id);
	}

	public int getRoleConunt() throws Exception {
		// TODO Auto-generated method stub
		return roleDao.getRoleConunt();
	}

	public List<Role> getRolePageInfo(int pageNO, int pageSize)
			throws Exception {
		// TODO Auto-generated method stub
		return roleDao.getRolePageInfo(pageNO, pageSize);
	}

	public boolean insertRole(Role role) throws Exception {
		// TODO Auto-generated method stub
		return roleDao.insertRole(role);
	}

	public boolean updateRole(Role role) throws Exception {
		// TODO Auto-generated method stub
		return roleDao.updateRole(role);
	}
	
	public List<Role> getAllRole() throws Exception{
		
		// TODO Auto-generated method stub
		return roleDao.getAllRole();
	}
}
